import request from '@/utils/request'

// 获取部门列表
export const reqGetDepartments = () => {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 根据id删除部门
 * @param {*} id 部门id
 */
export const reqDelDepartment = (id) => {
  return request({
    method: 'delete',
    url: '/company/department/' + id
  })
}

// 新增部门
export const reqAddDepartment = (data) => {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

// 根据ID查询部门详情
export const reqGetDepartDetail = id => {
  return request({
    method: 'get',
    url: `/company/department/${id}`
  })
}

/**
 * 根据id修改部门详情
 */
export const reqUpdateDepartDetail = (form) => {
  return request({
    method: 'put',
    url: '/company/department/' + form.id,
    data: form
  })
}
